﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;

namespace ArmoryData.Character
{
    public class ArenaTeam
    {
        /// <summary>
        /// Gets or sets the battlegroup of this <see cref="ArenaTeam"/>.
        /// </summary>
        public string BattleGroup { get; set; }
        /// <summary>
        /// Gets or sets the faction of this <see cref="ArenaTeam"/>.
        /// </summary>
        public string Faction { get; set; }
        /// <summary>
        /// Gets or sets the faction id of this <see cref="ArenaTeam"/>.
        /// </summary>
        public int FactionId { get; set; }
        /// <summary>
        /// Gets or sets the number of games played in this <see cref="ArenaTeam"/>.
        /// </summary>
        public int GamesPlayed { get; set; }
        /// <summary>
        /// Gets or sets the number of games won in this <see cref="ArenaTeam"/>.
        /// </summary>
        public int GamesWon { get; set; }
        /// <summary>
        /// Gets or sets last season's ranking of this <see cref="ArenaTeam"/>.
        /// </summary>
        public int LastSeasonRanking { get; set; }
        /// <summary>
        /// Gets or sets the name of this <see cref="ArenaTeam"/>.
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// Gets or sets the ranking of this <see cref="ArenaTeam"/>.
        /// </summary>
        public int Ranking { get; set; }
        /// <summary>
        /// Gets or sets the rating of this <see cref="ArenaTeam"/>.
        /// </summary>
        public int Rating { get; set; }
        /// <summary>
        /// Gets or sets this arena team's <see cref="Emblem"/>.
        /// </summary>
        public Emblem Emblem { get; set; }
        /// <summary>
        /// Gets or sets a list of the <see cref="Member"/>s in this <see cref="ArenaTeam"/>.
        /// </summary>
        public List<Member> Members { get; set; }
        /// <summary>
        /// Gets or sets the realm this<see cref="ArenaTeam"/> is in.
        /// </summary>
        public string Realm { get; set; }
        /// <summary>
        /// Gets or sets the url of the realm this <see cref="ArenaTeam"/> is in.
        /// </summary>
        public Uri RealmUrl { get; set; }
        /// <summary>
        /// Gets or sets the number of games won this season by this <see cref="ArenaTeam"/>.
        /// </summary>
        public int SeasonGamesWon { get; set; }
        /// <summary>
        /// Gets or sets the number of games played this season by this <see cref="ArenaTeam"/>.
        /// </summary>
        public int SeasonGamesPlayed { get; set; }
        /// <summary>
        /// Gets or sets the size of this <see cref="ArenaTeam"/>.
        /// </summary>
        public int Size { get; set; }


        /// <summary>
        /// Initializes a new instance of the <see cref="ArenaTeam"/> class.
        /// </summary>
        public ArenaTeam()
        {
            Emblem = new Emblem();
            Members = new List<Member>();
            RealmUrl = new Uri("http://example.com");
        }

        /// <summary>
        /// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
        /// </summary>
        /// <returns>
        /// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
        /// </returns>
        public override string ToString()
        {
            string ret = Name + Environment.NewLine;
            ret = string.Format(CultureInfo.CurrentCulture, "{0}v{0} Team Stats\t{1}\t{2}\t\t{3}", Size, GamesPlayed, string.Format(CultureInfo.CurrentCulture, "{0}-{1}", GamesWon, GamesPlayed - GamesWon), Rating);
            foreach (Member m in Members)
            {
                ret += Environment.NewLine + "-- " + m.ToString();
            }
            return ret;
        }
    }
}
